package com.hong.day04;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: csh
 * @Date: 2019/11/22 16:44
 * @Description:
 * 启动流程实例，动态设置assignee
 */
public class AssigneeUEL {

    public static void main(String[] args) {
        //1.得到defaultProcessEngine
        ProcessEngine defaultProcessEngine = ProcessEngines.getDefaultProcessEngine();
        //2.得到runtimeService
        RuntimeService runtimeService = defaultProcessEngine.getRuntimeService();
        //3.设置assignee的取值 用户可以在界面上设置流执行人
        Map<String,Object> map =new HashMap <String, Object>();
        map.put("assignee0","张三");
        map.put("assignee1","李四");
        map.put("assignee2","王五");

        //4.启动流程实例，，同时还要设置流程定义的assignee的值
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("holiday2", map);
        //5.输出
        System.out.println(processInstance.getName());

    }
}

